<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:f="livcos.org/ns/xslt/function"
  xmlns:h="livcos.org/ns/cosmos/history"
  exclude-result-prefixes="f h">

  <xsl:import href="/livcos.org/common/base.xsl" />
  <xsl:param name="view"/>
  
  <xsl:output method="xml"/>
	
  <xsl:template match="/*">
		<response>
			<xsl:copy-of select="$jobObject/h:changes" copy-namespaces="no"/>
			<xsl:variable name="caller" select="f:extract-object-id($view)"/>
			<xsl:variable name="paramChar" select="if (contains($view, '?')) then '&amp;' else '?'"/>
			<view>
				<xsl:copy-of select="doc(concat($view, $paramChar, 'callerObjId=', $caller))/*"/>
			</view>
		</response>
  </xsl:template>
  
</xsl:stylesheet>
